package com.fywsy.fyweb.strategy;

import com.fywsy.fyweb.entity.SendItem;
import com.fywsy.fyweb.utils.RestTemplateUtil;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
 * 寻道大千
 *
 * 游戏后台实现类
 * 注解gameId对应数据库游戏id
 * 注解GongnengMethod对应数据库功能id
 */
@Component
@GameId(21)
public class XundaoGameStrategy extends BaseGameStrategy {
    public static final String URL = "http://114.66.45.141:30781/gmss/user/admin.php";

    /**
     * type: mail
     * uid: 393217
     * item: 2
     * num: 12
     * qu: 10001
     * checknum: diyao88
     * @param item
     * @return
     */
    @GongnengMethod(2101)
    public String mail(SendItem item) {
        MultiValueMap<String,String> params = new LinkedMultiValueMap<>();
        params.add("type", "mail");
        params.add("checknum", "diyao88");

        params.add("qu", item.qufu);
        params.add("num", item.number);
        params.add("uid", item.uid);
        params.add("item", item.itemId);
        return RestTemplateUtil.sendPostForm(URL, params);
    }


    @GongnengMethod(4)
    public String cleat(SendItem item) {
        System.out.println("清除成功");
        return "清除成功";
    }


    public static void main(String[] args) {
        SendItem item = new SendItem();
        item.uid = "393217";
        item.itemId = "10";
        item.number = "123";
        item.qufu = "10001";
        System.out.println(new XundaoGameStrategy().mail(item));
    }
}

